package name.elftesting.vncelf;

import java.util.HashMap;
import java.util.Hashtable;

public class KeyMap {

	public static Hashtable hm = new Hashtable();

	public static int getKeyValue(String key) {
		if (hm.size() < 1) {
			hm.put("ENTER", new Integer(10));
			hm.put("BACKSPACE", new Integer(8));
			hm.put("TAB", new Integer(9));
			hm.put("CAPSLOCK", new Integer(20));
			hm.put("ESCAPE", new Integer(27));
			hm.put("UP", new Integer(38));
			hm.put("DOWN", new Integer(40));
			hm.put("LEFT", new Integer(37));
			hm.put("RIGHT", new Integer(39));
			hm.put("DELETE", new Integer(127));
			hm.put("HOME", new Integer(36));
			hm.put("PGUP", new Integer(33));
			hm.put( new Integer(10),"ENTER");
			hm.put(new Integer(8),"BACKSPACE" );
			hm.put( new Integer(9),"TAB");
			hm.put(new Integer(20),"CAPSLOCK");
			hm.put(new Integer(27),"ESCAPE" );
			hm.put(new Integer(38),"UP" );
			hm.put( new Integer(40),"DOWN");
			hm.put( new Integer(37),"LEFT");
			hm.put( new Integer(39),"RIGHT");
			hm.put( new Integer(127),"DELETE");
			hm.put( new Integer(36),"HOME");
			hm.put( new Integer(33),"PGUP");
		}
		Integer value = (Integer) hm.get(key.toUpperCase());
		return value.intValue();
	}
}
